:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #2c3e50;
  --text-secondary: #7f8c8d;
  --accent: #4a6cf7;
  --accent-hover: #3a5ce4;
  --border: #e1e8ed;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius: 12px;
  --gradient-1: #4a6cf7;
  --gradient-2: #8b5cf6;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

[data-theme='dark'] {
  --bg: #0a0e1a;
  --card: #151928;
  --text: #e2e8f0;
  --text-secondary: #a0aec0;
  --border: #2d3748;
  --accent: #7e3ff2;
  --accent-hover: #632cc9;
  --aurora-1: #3b82f6;
  --aurora-2: #8b5cf6;
  --aurora-3: #ec4899;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  padding: 2rem;
  min-height: 100vh;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 1.875rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gradient-1) 0%, var(--gradient-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.025em;
}

/* 极光效果 */
[data-theme='dark'] body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(139, 92, 246, 0.05) 50%, rgba(236, 72, 153, 0.05) 100%);
  z-index: -1;
  pointer-events: none;
}

[data-theme='dark'] .card {
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(145deg, rgba(21, 25, 40, 0.8) 0%, rgba(15, 19, 34, 0.8) 100%);
  backdrop-filter: blur(10px);
}

[data-theme='dark'] .card:hover {
  border-color: var(--aurora-1);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.2), 0 0 30px rgba(139, 92, 246, 0.1);
}

[data-theme='dark'] .search-container {
  background: linear-gradient(145deg, rgba(21, 25, 40, 0.8) 0%, rgba(15, 19, 34, 0.8) 100%);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme='dark'] .engine-btn.active {
  color: var(--aurora-2);
  background: rgba(139, 92, 246, 0.15);
}

[data-theme='dark'] .search-btn {
  background: linear-gradient(135deg, var(--aurora-1) 0%, var(--aurora-2) 100%);
}

[data-theme='dark'] .search-btn:hover {
  background: linear-gradient(135deg, var(--aurora-2) 0%, var(--aurora-3) 100%);
}

button {
  cursor: pointer;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 0.625rem 1rem;
  font-weight: 500;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* 主题切换按钮样式 */
#themeToggle {
  background: transparent;
  color: var(--text);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  padding: 0;
  box-shadow: none;
  font-size: 20px;
}

#themeToggle:hover {
  background: rgba(59, 130, 246, 0.1);
  transform: rotate(15deg);
}

#themeToggle:active {
  transform: rotate(5deg);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--gradient-1);
}

.card:active {
  transform: translateY(-2px);
}

.card img {
  width: 48px;
  height: 48px;
  margin-bottom: 0.75rem;
  transition: var(--transition);
}

.card:hover img {
  transform: scale(1.1);
}

.card div {
  font-weight: 500;
  font-size: 0.875rem;
  transition: var(--transition);
}

.search-box {
  margin-bottom: 2rem;
}

.search-container {
  max-width: 600px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: var(--transition);
}

.search-container:hover {
  box-shadow: var(--shadow-lg);
}

.search-engines {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.engine-btn {
  flex: 1;
  padding: 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  border-radius: 0;
  box-shadow: none;
}

.engine-btn:hover {
  color: var(--text);
  background: rgba(59, 130, 246, 0.05);
}

.engine-btn.active {
  color: var(--gradient-1);
  background: rgba(74, 108, 247, 0.1);
}

.search-input-container {
  display: flex;
  align-items: center;
  padding: 0.5rem;
}

.search-input-container input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

.search-input-container input::placeholder {
  color: var(--text-secondary);
}

.search-btn {
  background: linear-gradient(135deg, var(--gradient-1) 0%, var(--gradient-2) 100%);
  color: white;
  border: none;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
}

.search-btn:hover {
  background: linear-gradient(135deg, var(--gradient-2) 0%, var(--gradient-1) 100%);
  transform: scale(1.05);
}

/* 右键菜单 */
.ctx-menu {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  z-index: 1000;
  min-width: 160px;
}

.ctx-menu div {
  padding: 0.625rem 1rem;
  transition: var(--transition);
  cursor: pointer;
  font-size: 0.875rem;
}

.ctx-menu div:hover {
  background: var(--accent);
  color: #fff;
}

.ctx-menu div:first-child {
  border-radius: var(--radius) var(--radius) 0 0;
}

.ctx-menu div:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
}

/* 弹窗遮罩 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease-out;
}

.modal {
  background: var(--card);
  padding: 1.75rem;
  border-radius: var(--radius);
  width: 480px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: slideUp 0.3s ease-out;
}

.modal h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.modal label {
  display: flex;
  flex-direction: row;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  gap: 0.5rem;
}

.modal label strong {
  min-width: 80px;
  text-align: justify;
  text-align-last: justify;
  margin-right: 0.5rem;
}

.modal input {
  flex: 1;
  padding: 0.625rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  transition: var(--transition);
  text-align: left;
}

.modal input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 图标预览区域样式 */
.icon-preview-section {
  margin-bottom: 1rem;
}

.preview-title {
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
  font-size: 0.875rem;
}

.icon-preview-container {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.preview-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.preview-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
}

.preview-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.preview-icon.selected {
  box-shadow: 0 0 0 2px var(--accent);
}

.online-icon-wrapper {
  position: relative;
  cursor: pointer;
}

.text-icon-wrapper {
  position: relative;
  cursor: pointer;
}

.fetch-hint {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.3s ease;
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 1;
}

.preview-icon img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.text-icon {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  background: linear-gradient(135deg, var(--gradient-1) 0%, var(--gradient-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.modal-btns {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.modal-btns button {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}

.modal-btns button:first-child {
  background: var(--accent);
  color: #fff;
}

.modal-btns button:first-child:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.modal-btns button:last-child {
  background: #fff;
  color: #ef4444;
  border: 1px solid #ef4444;
}

.modal-btns button:last-child:hover {
  background: #ef4444;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.modal-btns button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* 动画 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 分隔线样式 */
.divider {
  height: 1px;
  background-color: var(--border);
  margin: 1rem -1.75rem;
  width: calc(100% + 3.5rem);
}

/* 响应式调整 */
@media (max-width: 640px) {
  body {
    padding: 1rem;
  }
  
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
  }
  
  .card {
    padding: 1rem;
  }
  
  .card img {
    width: 40px;
    height: 40px;
  }
  
  .modal {
    width: 90%;
    max-width: 360px;
  }
}

/* 通知样式 */
#notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
}

.notification {
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  margin-bottom: 10px;
  transform: translateX(120%);
  transition: transform 0.3s ease;
  max-width: 300px;
}

.notification.visible {
  transform: translateX(0);
}

.notification.info {
  background: var(--gradient-1);
}

.notification.success {
  background: #10b981;
}

.notification.error {
  background: #ef4444;
}

.notification.warning {
  background: #f59e0b;
}
